package com.jf3q.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jf3q.admin.service.EduMemberService;
import com.jf3q.admin.service.EduTeacherService;
import com.jf3q.common.domain.EduMember;
import com.jf3q.common.domain.EduTeacher;
import com.jf3q.common.vo.MemberVo;
import com.jf3q.common.vo.ResultVo;
import com.jf3q.common.vo.SearchTeacherVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/member")
public class MemberController {
    @Autowired
    EduMemberService eduMemberService;
    @PostMapping("page/{pageNum}")
    @Operation(summary = "会员分页查询接口")
    public ResultVo get(@PathVariable Integer pageNum,
                        @RequestBody(required = false) MemberVo memberVo){

        Page<EduMember> page=eduMemberService.getPage(pageNum,memberVo);
        return ResultVo.success("查询所有会员",page);
    }
    @PostMapping("/{id}")
    public ResultVo putId(@PathVariable String id){
        EduMember member = eduMemberService.getById(id);
        member.setIsDisabled(true);
        eduMemberService.saveOrUpdate(member);
        return ResultVo.success();
    }
}
